package com.bharatonjava.college.managedBeans;

import java.util.HashSet;
import java.util.Set;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bharatonjava.college.domain.Enumeration;
import com.bharatonjava.college.domain.Student;
import com.bharatonjava.college.services.CommonService;
import com.bharatonjava.college.utils.Constants;

@Component
@ManagedBean(name="reg")
@SessionScoped
public class StudentFormBean {

	private Student student;
	private String password;
	private Set<Enumeration> standards = new HashSet<Enumeration>();
	
	@ManagedProperty(value="#{commonService}")
	private CommonService commonService;

	public Student getStudent() {
		return student;
	}
	
	public void setStandards(Set<Enumeration> standards) {
		this.standards = standards;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public Set<Enumeration> getStandards() {
		return standards;
	}
	
	public void setStudent(Student student) {
		this.student = student;
	}
	
	public void setCommonService(CommonService commonService) {
		this.commonService = commonService;
	}
	
	@PostConstruct
	public void initialize(){
		System.out.println("initialized");
		// this.standards = this.commonService.getEnumerationsByGroupId(Constants.PROFILE_FOR);
		// System.out.println(standards);
	}
	
	@PreDestroy
	public void shutdown(){
		
	}

}

